package io.renren.modules.generator.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.modules.generator.entity.TbMovieRecommendEntity;
import io.renren.modules.generator.service.TbMovieRecommendService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author Xiaotianyu
 * @email 805007911@qq.com
 * @date 2021-10-13 15:25:03
 */
@RestController
@RequestMapping("generator/tbmovierecommend")
public class TbMovieRecommendController {
    @Autowired
    private TbMovieRecommendService tbMovieRecommendService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("generator:tbmovierecommend:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tbMovieRecommendService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("generator:tbmovierecommend:info")
    public R info(@PathVariable("id") Integer id){
		TbMovieRecommendEntity tbMovieRecommend = tbMovieRecommendService.getById(id);

        return R.ok().put("tbMovieRecommend", tbMovieRecommend);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:tbmovierecommend:save")
    public R save(@RequestBody TbMovieRecommendEntity tbMovieRecommend){
		tbMovieRecommendService.save(tbMovieRecommend);

        return R.ok();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    @RequiresPermissions("generator:tbmovierecommend:update")
    public R update(@RequestBody TbMovieRecommendEntity tbMovieRecommend){
		tbMovieRecommendService.updateById(tbMovieRecommend);

        return R.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    @RequiresPermissions("generator:tbmovierecommend:delete")
    public R delete(@RequestBody Integer[] ids){
		tbMovieRecommendService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
